using System;
using System.Linq.Expressions;
using PropertyExpression.ControllableQuery.TypedReader;

namespace PropertyExpression.ControllableQuery.Test
{
    public static class TupleDataReaderExtensions
    {
        private static class Properties<T1, T2, T3>
        {
            internal static readonly Expression<Func<Tuple<T1, T2, T3>, T1>> Item1 = _ => _.Item1;
            internal static readonly Expression<Func<Tuple<T1, T2, T3>, T2>> Item2 = _ => _.Item2;
            internal static readonly Expression<Func<Tuple<T1, T2, T3>, T3>> Item3 = _ => _.Item3;            
        }

        public static Guid Item1<T2, T3>(this IDataReader<Tuple<Guid, T2, T3>> it)
        {
            return it.GetValue(Properties<Guid, T2, T3>.Item1);
        }

        public static NVarChar<L4000> Item2<T1, T3>(this IDataReader<Tuple<T1, NVarChar<L4000>, T3>> it)
        {
            return it.GetValue(Properties<T1, NVarChar<L4000>, T3>.Item2);
        }

        public static NVarChar<L4000> Item3<T1, T2>(this IDataReader<Tuple<T1, T2, NVarChar<L4000>>> it)
        {
            return it.GetValue(Properties<T1, T2, NVarChar<L4000>>.Item3);
        }
    }
}